package com.example.ai.treeService;

import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.spring.AiService;
import dev.langchain4j.service.spring.AiServiceWiringMode;
import reactor.core.publisher.Flux;

/**
 * wiringMode：创建代理对象是手动装配还是自动装配，手动就是要指定模型，自动则不需要指定模型（自动去IOC容器中找chatModel）
 * chatModel：指定模型
 */
@AiService(wiringMode = AiServiceWiringMode.EXPLICIT,
        streamingChatModel = "openAiStreamingChatModel",
        chatMemoryProvider = "chatMemoryProvider",//配置会话记忆提供者对象
        contentRetriever = "contentRetriever",
        tools = "toolProvider"
)
public interface TreeService {
    // 用于聊天的方法
    //基于类路径去找系统消息
    @SystemMessage(fromResource = "system.txt")
    Flux<String> chat(@MemoryId String memoryId, @UserMessage String message);
}
